"""
静态方法

Version: 0.1
Author: yuwl
Date：2024-3-26
"""

from math import sqrt

class Triangle(object):

    def __init__(self, a, b, c):
        self._a = a
        self._b = b
        self._c = c

    # 静态方法
    @staticmethod
    def is_valid(a, b, c):
        return a + b > c and b + c > a and a + c > b
    
    def perimeter(self):
        return self._a + self._b + self._c
    
    def area(self):
        half = self.perimeter() / 2
        return sqrt(half * (half - self._a) * (half - self._b) * (half - self._c))
    
def main():
    a, b, c = 3, 4, 5
    if Triangle.is_valid(a, b, c):
        t = Triangle(3, 4, 5)
        print(t.perimeter())
        print(Triangle.perimeter(t))
        print(t.area())
        print(Triangle.area(t))

if __name__ == '__main__':
    main()